//
//  EJSAddressTableViewCell.m
//  EnjoyShoppingStreet
//
//  Created by lifayu on 2017/12/13.
//  Copyright © 2017年 lifayu. All rights reserved.
//

#import "EJSAddressTableViewCell.h"
#import "EJSAddressModel.h"

@interface EJSAddressTableViewCell()


@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *defaultLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *selectButtonLeadding;//地址管理时 设为-10 并隐藏selectButton 选择地址时 设为25 显示selectButton

@end


@implementation EJSAddressTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setManageAddressType:(NSInteger)manageAddressType addressModel:(EJSAddressModel *)addressModel{
    if(manageAddressType == 0){
        self.selectButtonLeadding.constant = -10;
        self.selectButton.hidden = YES;
    }else{
        self.selectButtonLeadding.constant = 25;
        self.selectButton.hidden = NO;
    }
    
    self.nameLabel.text = addressModel.man;
    self.phoneLabel.text = addressModel.phone;
    self.addressLabel.text = [NSString stringWithFormat:@"%@ %@",[addressModel.areaJson componentsJoinedByString:@" "],addressModel.address];
    if(addressModel.defaultFlag.integerValue == 1){
        self.defaultLabel.hidden = NO;
    }else{
        self.defaultLabel.hidden = YES;
    }
}

@end
